import { Redirect } from 'umi';
import { message } from 'antd';

export default (props: any) => {
  const isUser =
    localStorage.getItem('identity') === '用户' ||
    localStorage.getItem('identity') === '管理员';
  if (isUser) {
    return <div>{props.children}</div>;
  } else {
    message.error('当前用户没有权限！！！');
    return <Redirect to="/" />;
  }
};
